// ignore_for_file: public_member_api_docs, sort_constructors_first
import 'dart:convert';

class Student {
  int studentId;
  String studentName;
  int studentScore;
  Student({
    required this.studentId,
    required this.studentName,
    required this.studentScore,
  });
  

  Student copyWith({
    int? studentId,
    String? studentName,
    int? studentScore,
  }) {
    return Student(
      studentId: studentId ?? this.studentId,
      studentName: studentName ?? this.studentName,
      studentScore: studentScore ?? this.studentScore,
    );
  }

  Map<String, dynamic> toMap() {
    return <String, dynamic>{
      'studentId': studentId,
      'studentName': studentName,
      'studentScore': studentScore,
    };
  }

  factory Student.fromMap(Map<String, dynamic> map) {
    return Student(
      studentId: map['studentId'] as int,
      studentName: map['studentName'] as String,
      studentScore: map['studentScore'] as int,
    );
  }

  String toJson() => json.encode(toMap());

  factory Student.fromJson(String source) => Student.fromMap(json.decode(source) as Map<String, dynamic>);

  @override
  String toString() => 'Student(studentId: $studentId, studentName: $studentName, studentScore: $studentScore)';

  @override
  bool operator ==(covariant Student other) {
    if (identical(this, other)) return true;
  
    return 
      other.studentId == studentId &&
      other.studentName == studentName &&
      other.studentScore == studentScore;
  }

  @override
  int get hashCode => studentId.hashCode ^ studentName.hashCode ^ studentScore.hashCode;
}
